#include "UdpSendTask.h"

void Call::UdpSendTask::Run()
{
    int no;
    while (1)
    {
        CharBuf buf;
        WS::SockAddrIn to;

        Config config;
        to.SetIP(config.host.c_str());
        to.SetPort(config.udpPort);

        buf.no = no;

        int len = m_UdpSocket.SendTo<CharBuf>(buf, to);
        LOGI("has Send udpBuffer %d", no);
        std::this_thread::sleep_for(std::chrono::milliseconds(500));

        no++;
    }
}

bool Call::UdpSendTask::Create()
{
    WS::UdpSocket::Desc desc;

    if (!m_UdpSocket.Create(desc))
    {
        LOGI("cannot create the udp Socket");
        return false;
    }
    return true;
}
